import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import NoticeHome from '../views/NoticeHome.vue'
import Dorm from '../views/Dorm.vue'
import Student from '../views/Student.vue'
import Admin from '../views/Admin.vue'
import Notice from '../views/Notice.vue'
import Error from '../views/Error.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/login'
  },
  {
    path: '/home',
    name: 'home',
    component: Home,
/*     redirect:'/home/noticehome', */
    
    children:[
      // {
      //   path:"",
      //   component:NoticeHome
      // },
      {
        path:'noticehome',
        name:'noticehome',
        component:()=>import('../views/NoticeHome.vue')
        
        
      },
      {
        path:'student',
        component:()=>import('../views/Student.vue')
      },
      {
        path:'dorm',
        component:()=>import('../views/Dorm.vue')
      },
      {
        path:'notice',
        component:()=>import('../views/Notice.vue')
      },
      {
        path:'/home/admin',
        name:'admin',
        component:()=>import('../views/Admin.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component:()=>import('../views/Login.vue')
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    // component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path:'*',
    component:Error
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
